<me:UIEKP x:Class="WPFExcelReport.TFEK02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"   
                    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                    xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"    
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"  
                    xmlns:LS="clr-namespace:WPFExcelReport;assembly=TLIEFDAT"  
                    xmlns:VAK="clr-namespace:WPFExcelReport;assembly=TVAKOLL" 
                    xmlns:QTB="clr-namespace:WPFExcelReport;assembly=TICC_QUERYTB"  
                    x:Name="TV"   
                    Loaded="Window_Loaded"
     >
    <me:UIEKP.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:PreisConverter  x:Key="price"/>
    </me:UIEKP.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel >
            
            <WrapPanel Height="34">
                <WrapPanel Height="34">
                    <Grid Margin="10,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <LS:TSLS02 Grid.Column="1" MinWidth="100" 
                                   KEY="{Binding Path=DES,ElementName=TV}" 
                                   IsEdit="True"
                                    Width="Auto" />
                    </Grid>
                    <Grid Margin="10,0,0,0"  >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=采购单}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2"   IsAutoClear="False" 
                               IsAutoEnter="False"
                              CharacterCasing="Upper" Text="{Binding KRS,ElementName=TV}"  
                              KeyUp="Query_KeyUp" Width="30" />
                        <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="6"  IsAutoClear="True" 
                              IsAutoEnter="False"
                              Text="{Binding LFD,ElementName=TV}"  KeyUp="Query_KeyUp"  Width="90" />
                    </Grid> 
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Column="0" FontSize="16"  Text="{Binding Source={Localization:Translate Word=品种编号:}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" Margin="5,0,0,0" MaxLength="20"  IsAutoClear="False" 
                              IsAutoEnter="False"
                              Text="{Binding ART,ElementName=TV}"  KeyUp="Query_KeyUp"  Width="120" />
                        <TextBlock Grid.Column="2" FontSize="16"  Text="{Binding Source={Localization:Translate Word=季节:}}"/>
                        <VAK:TSVA02  Grid.Column="3"  KEY="{Binding KOLL,ElementName=TV}" 
                               ORDERNUM="{Binding KOLL,ElementName=TV}" 
                             Width="AUTO" />
                        <!--<ex:TXT72 Grid.Column="3" FontSize="16" Margin="5,0,0,0" MaxLength="10"  IsAutoClear="False" 
                              IsAutoEnter="False"
                              Text="{Binding KOLL,ElementName=TV}"  KeyUp="Query_KeyUp"  Width="70" />-->
                        <TextBlock Grid.Column="4" FontSize="16"  Text="{Binding Source={Localization:Translate Word=类 型：}}" HorizontalAlignment="Left" Width="53"/>
                        <!--<ex:TXT72 Grid.Column="5" FontSize="16" Margin="5,0,0,0" MaxLength="10"  IsAutoClear="False" 
                              IsAutoEnter="False"
                              Text="{Binding TKEY1,ElementName=TV}"  KeyUp="Query_KeyUp"  Width="100" />-->
                        <!--<TextBox Grid.Column="5" Text="{Binding FARBE,Converter={StaticResource gb2312},ElementName=TV}" Width="60"/>-->
                        <SD:K8884  Grid.Column="6" KEY="{Binding AUFART,ElementName=TV}"  Width="100"
                               IsEdit="True"
                                ORDERNUM="{Binding AUFART,ElementName=TV }" />
                        <!--<TextBox Name="txtTPY" Width="100" Grid.Column="5" FontSize="16" Margin="5,0,0,0"></TextBox>-->
                        <!--<ex:TXT72 Grid.Column="5" FontSize="16" Margin="5,0,0,0" MaxLength="10"  IsAutoClear="False" 
                              IsAutoEnter="False" Name="txtTPY"
                              Text="{Binding TXTISIND,Converter={StaticResource gb2312},ElementName=TV }"  KeyUp="Query_KeyUp"  Width="70" />-->

                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Label Content="{Binding Source={Localization:Translate Word=交期}}" Grid.Column="0"  HorizontalAlignment="Left" Margin="10,0,0,0"  Width="Auto" FontSize="16" />
                        <DatePicker Grid.Column="1"     HorizontalAlignment="Left" Margin="0,2,0,0"    Panel.ZIndex="4"
                            Text="{Binding DTSTART,ElementName=TV}"   KeyUp="Query_KeyUp" SelectedDateChanged ="DTSTART_SelectedDateChanged" />
                        <Label Content="{Binding Source={Localization:Translate Word=-}}" Grid.Column="2"   HorizontalAlignment="Left" Margin="10,0,0,0"   Width="Auto" FontSize="16" />
                        <DatePicker Grid.Column="3"    KeyUp="Query_KeyUp"  HorizontalAlignment="Left" Margin="0,0,0,0"   VerticalAlignment="Center" Panel.ZIndex="5"
                                 Text="{Binding DTEND,ElementName=TV}"    SelectedDateChanged ="DTEND_SelectedDateChanged"  />                      
                    </Grid>
          
                </WrapPanel> 
                <Button Content="{Binding Source={Localization:Translate Word=查询}}" Height="33" Margin="10,0,0,0"   Width="96" Panel.ZIndex="9"
                        Click="QueryCommand"/>
            
                <Button    Content="{Binding Source={Localization:Translate Word=导出}}" Height="33" Margin="10,0,0,0"   Width="100" Panel.ZIndex="10"
                    Click="PrintCommand"   />

            </WrapPanel>

        </StackPanel>

        <DataGrid  Grid.Row="1" Grid.Column="0"
                   Grid.RowSpan="2"
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"
                   Name="dlgMaster"
                   ItemsSource="{Binding Source={StaticResource vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=EKPSA}" Header="{Binding Source={Localization:Translate Word=状态}}" Width="Auto"  />
                <DataGridTextColumn Binding="{Binding Path=TYP,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=类型}}" Width="Auto"  />
                <DataGridTextColumn Header="" Binding="{Binding EKKAUFKRS}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKKAUFLFD}" Width="Auto"/>
                <DataGridTextColumn Header="" Binding="{Binding EKPAUFPOS}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=供应商}}" Binding="{Binding EKKLIEFNR,Converter={StaticResource pnum}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=供应商名称}}" Binding="{Binding LSLIEFNA,Converter={StaticResource gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=销售单}}" Binding="{Binding ABAVKAUF}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=客户}}" Binding="{Binding CUSTOMER,Converter={StaticResource ResourceKey=gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=系列}}" Binding="{Binding KOLL}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=品种编号}}" Binding="{Binding PART}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=色号}}" Binding="{Binding PFARBE}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=数量}}" Binding="{Binding Path=EKPME1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding Path=EKPME3,Converter={StaticResource d100}}" Header="{Binding Source={Localization:Translate Word=实收}}" Width="Auto" MinWidth="30" />
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=交期}}" Binding="{Binding EKPLTERM}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding Path=EKPGENDAT1}" Header="{Binding Source={Localization:Translate Word=船样}}" Width="80" MinWidth="30" />
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=单价}}" Binding="{Binding EKPPRME,Converter={StaticResource price} }" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=币种}}" Binding="{Binding EKKWAEHRSL}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=总金额}}" Binding="{Binding VALUE}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=附加费}}" Binding="{Binding SUR}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=折扣}}" Binding="{Binding DIS}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=付款方式}}" Binding="{Binding ZAHLBED}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=贸易方式}}" Binding="{Binding LIEFBED}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=运输方式}}" Binding="{Binding SART}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=承运人}}" Binding="{Binding VSPED}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding Path=EKPWUTERM}" Header="{Binding Source={Localization:Translate Word=确认}}" Width="80" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=EKPSACHB}" Header="{Binding Source={Localization:Translate Word=负责人}}" Width="Auto" MinWidth="30" />
                <!--DataGridTextColumn Binding="{Binding Path=VKZZUART1}" Header="{Binding Source={Localization:Translate Word=加1}}"  MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZZUABWERT1}" Header="{Binding Source={Localization:Translate Word=费1}}"  MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZRABART1}" Header="{Binding Source={Localization:Translate Word=折1}}"   MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZVERPWERT1}" Header="{Binding Source={Localization:Translate Word=扣1}}"   MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZZUART2}" Header="{Binding Source={Localization:Translate Word=加1}}"  MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZZUABWERT2}" Header="{Binding Source={Localization:Translate Word=费2}}"   MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZRABART2}" Header="{Binding Source={Localization:Translate Word=折2}}"   MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VKZVERPWERT2}" Header="{Binding Source={Localization:Translate Word=扣2}}"   MinWidth="30" /-->

            </DataGrid.Columns>
        </DataGrid  >
        <WrapPanel Grid.Row="2"  IsEnabled="{Binding IsInactive,ElementName=TV}">
            <WrapPanel >
                <TextBlock Text="{Binding TKEY1}" FontSize="16" Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding SUM1,Converter={StaticResource d100}}" FontSize="16"  Foreground="Red" Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding TKEY2}"  FontSize="16"  Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding SUM2}" FontSize="16"  Foreground="Red" Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding TKEY3}" FontSize="16"   Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding SUM3}" FontSize="16"  Foreground="Red" Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding TCOUNT1}" FontSize="16"   Margin="10,0,0,0"></TextBlock>
                <TextBlock Text="{Binding Counts}" FontSize="16"  Foreground="Red" Margin="20,0,0,0"></TextBlock>
            </WrapPanel>
        </WrapPanel>
        <ex:TPage  Grid.Row="3" Visibility="{Binding IsPage,Converter={StaticResource bv}}"/>
    </Grid> 
</me:UIEKP>
